//
//  WSRechargeCell.m
//  CharonTVProject
//
//  Created by karong on 2023/8/10.
//

#import "WSRechargeCell.h"
#import "WSGoods.h"
#import "UIView+WSDraw.h"
@interface WSRechargeCell ()
@property (weak, nonatomic) IBOutlet UIView *mainView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *discountTitleLabel;
@property (weak, nonatomic) IBOutlet UIView *discountTitleView;
@property (weak, nonatomic) IBOutlet UIButton *priceBtn;
@end

@implementation WSRechargeCell
- (void)awakeFromNib {
    [super awakeFromNib];
    [self.discountTitleView setupRoundedCornersWithCutCorners:(UIRectCornerTopLeft | UIRectCornerBottomRight) withRadii:CGSizeMake(5, 5)];
}

- (void)setDataWithObject:(WSGoods *)object {
    [self.priceBtn setTitle:WSSF(@"$%.2f", object.price) forState:(UIControlStateNormal)];
    self.titleLabel.text = WSSF(@"%@+%ld剧豆",object.title, (long)object.give_coins);
    [self setDiscountStatusWithObject:object];
}

- (void) setDiscountStatusWithObject:(WSGoods *)object {
    if (WSIsNullOrEmpty(object.vip_activity_tag)) {
        self.discountTitleView.hidden = YES;
    }
    else {
        self.discountTitleView.hidden = NO;
        self.discountTitleLabel.text = object.vip_activity_tag;
    }
}

- (void)setDataWithObject:(id)object select:(BOOL)select {
    [self setDataWithObject:object];
    self.mainView.layer.borderColor = select?UIColor.font_yellow_FCB625.CGColor:UIColor.clearColor.CGColor;
    self.mainView.layer.borderWidth = select?1:0;
}

@end
